//=============================================================================
// System  : MatchKit
// File    : ObjectMapperOptions.cs
// Author  : Fabio Bussu  (matchkit@fabiobussu.it)
// Updated : 04/16/2013
// Note    : Copyright 2013, Fabio Bussu, All rights reserved
//
// This code is published under the Microsoft Public License (Ms-PL). A copy
// of the license should be distributed with the code.  It can also be found
// at the project website: http://matchkit.codeplex.com. This notice, the
// author's name, and all copyright notices must remain intact in all
// applications, documentation, and source files.
//
// Version     Date     Who  Comments
// ============================================================================
// 1.0.0.0  04/16/2013   FB  First draft
//=============================================================================
using System;
using System.Runtime.Serialization;
using System.Threading;

namespace MatchKit.ObjectMapping
{
	/// <summary>
	/// Provides options to control the mapping process.
	/// </summary>
	/// <threadsafety static="true" instance="false" />
	/// <serialization binary="true" contract="true" />
	/// <conceptualLink target="7e345cd8-8943-4616-a3c9-abcc9344dabc" />
	/// <conceptualLink target="7e345cd8-5aaa-4616-a3c9-abcd0544dabc" />
	/// <conceptualLink target="0a06b2a9-5f58-409a-ba62-639cfd77bca7" />
	#if DC
	[DataContract]
	#endif
	#if SZ
	[Serializable]
	#endif
	public sealed class ObjectMapperOptions
	{
		/// <summary>
		/// Gets or sets a value specifying whether to check for the end of string at the end 
		/// of the mapping process.
		/// <br />
		/// Default value is <b>false</b>.
		/// </summary>
		/// <serialization member="true" />
		#if DC
		[DataMember]
		#endif
		public bool EndsWithEos { get; set; }

		/// <summary>
		/// Gets or sets a value specifying how ignore blanks.
		/// <br />
		/// Default value is <b>None</b>.
		/// </summary>
		/// <serialization member="true" />
		#if DC
		[DataMember]
		#endif
		public IgnoreBlank IgnoreBlanks { get; set; }

		/// <summary>
		/// Gets or sets a generic pattern to ignore; this pattern is checked between each 
		/// matchable member.
		/// <br />
		/// Default value is <b>null</b>.
		/// </summary>
		/// <serialization member="true" />
		/// <conceptualLink target="7e345cd8-8943-4616-a3c9-abcc9344dabc" />
		#if DC
		[DataMember]
		#endif
		public IPattern NullPattern { get; set; }

		/// <summary>
		/// Gets or sets the match tracer.
		/// <br />
		/// Default value is <b>null</b>.
		/// </summary>
		/// <serialization member="true" />
		#if DC
		[DataMember]
		#endif
		public IMatchTracer Tracer { get; set; }

		/// <summary>
		/// Gets or sets the match bag.
		/// <br />
		/// Default value is <b>null</b>.
		/// </summary>
		/// <serialization member="true" />
		/// <conceptualLink target="7e345cd8-5aaa-4616-a3c9-abcd0544dabc" />
		#if DC
		[DataMember]
		#endif
		public IMatchBag MatchBag { get; set; }

		/// <summary>
		/// Gets or sets the object to request cancellation of the mapping process. 
		/// <br />
		/// Default value is <see cref="P:MatchKit.CancellationFlag.None"/>.
		/// </summary>
		/// <serialization member="true" />
		#if DC
		[DataMember]
		#endif
		public CancellationFlag CancellationFlag { get; set; }

		/// <summary>
		/// Gets or sets the timeout for the mapping process.
		/// <br />
		/// Default value is <see cref="F:MatchKit.MatchOptions.InfiniteTimeout"/>.
		/// </summary>
		/// <serialization member="true" />
		#if DC
		[DataMember]
		#endif
		public TimeSpan Timeout { get; set; }

		/// <summary>
		/// Initializes a new instance of the <see cref="T:MatchKit.ObjectMapperOptions"/> class. 
		/// </summary>
		public ObjectMapperOptions()
		{
			EndsWithEos = false;
			IgnoreBlanks = IgnoreBlank.None;
			NullPattern = null;
			Tracer = null;
			MatchBag = null;
			CancellationFlag = CancellationFlag.None;
			Timeout = MatchOptions.InfiniteTimeout;
		}
	}
}
